<!-- 新增工单 -->
<template>
  <div v-loading="loading">
    <ProTable :columns="columns" :data="list" row-key="eno" :tool-button="false" :pagination="false" max-height="500"></ProTable>
  </div>
</template>

<script setup lang="ts" name="NewWorkList">
import { ref, reactive, onMounted } from "vue";
import { findbenri } from "@/api/modules/index";
import ProTable from "@/components/ProTable/index.vue";
import { useRouter } from "vue-router";

// 表格配置项
const columns = reactive([
  { prop: "createdByName", label: "创建人", width: 120 },
  {
    prop: "edesc",
    label: "请求内容",
    render: scope => {
      return scope.row.edesc.length > 0 ? scope.row.edesc.replace("<p>", "").replace("</p>", "") : scope.row.edesc;
    }
  },
  { prop: "createdOn", label: "创建时间", width: 180 }
]);

const router = useRouter();
const list = ref<any[]>([]);
const loading = ref(false);

onMounted(() => {
  loading.value = true;
  setTimeout(() => {
    findbenri({})
      .then((res: any) => {
        list.value = res || [];
        loading.value = false;
      })
      .catch(() => {
        loading.value = false;
      });
  }, Math.random() * 500);
});
</script>

<style scoped>
:deep(.card) {
  padding: 10px;
  border: none;
}
</style>
